package com.ht.mq.simple;

import com.ht.mq.utils.ConnectionUtil;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

import java.nio.charset.StandardCharsets;

public class Sender {

    public static void main(String[] args) throws Exception {
        //获取连接
        Connection connection = ConnectionUtil.getConnection();
        //创建通道，类似于数据库中的statement
        Channel channel = connection.createChannel();
        channel.queueDeclare("biubiu",true,false,false,null);
        for (int i = 0; i < 100 ;i++) {
            channel.basicPublish("","biubiu",null,("可惜都不是你们的"+i).getBytes(StandardCharsets.UTF_8));
        }
    }
}
